package com.zhny.project.exec.display.service.impl;

import java.util.List;
import java.util.UUID;

import com.zhny.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhny.project.exec.display.mapper.AlgorithmDisplayMapper;
import com.zhny.project.exec.display.domain.AlgorithmDisplay;
import com.zhny.project.exec.display.service.IAlgorithmDisplayService;
import com.zhny.common.utils.text.Convert;

/**
 * 算法演示Service业务层处理
 *
 * @author yanqun
 * @date 2019-11-25
 */
@Service
public class AlgorithmDisplayServiceImpl implements IAlgorithmDisplayService
{
    @Autowired
    private AlgorithmDisplayMapper algorithmDisplayMapper;

    /**
     * 查询算法演示
     *
     * @param algorithmKey 算法演示ID
     * @return 算法演示
     */
    @Override
    public AlgorithmDisplay selectAlgorithmDisplayById(String algorithmKey)
    {
        return algorithmDisplayMapper.selectAlgorithmDisplayById(algorithmKey);
    }

    /**
     * 查询算法演示列表
     *
     * @param algorithmDisplay 算法演示
     * @return 算法演示
     */
    @Override
    public List<AlgorithmDisplay> selectAlgorithmDisplayList(AlgorithmDisplay algorithmDisplay)
    {
        return algorithmDisplayMapper.selectAlgorithmDisplayList(algorithmDisplay);
    }

    /**
     * 新增算法演示
     *
     * @param algorithmDisplay 算法演示
     * @return 结果
     */
    @Override
    public int insertAlgorithmDisplay(AlgorithmDisplay algorithmDisplay)
    {
        algorithmDisplay.setCreateTime(DateUtils.getNowDate());
        algorithmDisplay.setAlgorithmKey(UUID.randomUUID().toString());
        return algorithmDisplayMapper.insertAlgorithmDisplay(algorithmDisplay);
    }

    /**
     * 修改算法演示
     *
     * @param algorithmDisplay 算法演示
     * @return 结果
     */
    @Override
    public int updateAlgorithmDisplay(AlgorithmDisplay algorithmDisplay)
    {
        algorithmDisplay.setUpdateTime(DateUtils.getNowDate());
        return algorithmDisplayMapper.updateAlgorithmDisplay(algorithmDisplay);
    }

    /**
     * 删除算法演示对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAlgorithmDisplayByIds(String ids)
    {
        return algorithmDisplayMapper.deleteAlgorithmDisplayByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除算法演示信息
     *
     * @param algorithmKey 算法演示ID
     * @return 结果
     */
    public int deleteAlgorithmDisplayById(String algorithmKey)
    {
        return algorithmDisplayMapper.deleteAlgorithmDisplayById(algorithmKey);
    }
}
